//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package SaveServlet.course;

import com.lyq.bean.service.TC_Service;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

@WebServlet({"/MyTeachCourse_Servlet"})
public class MyTeachCourse_Servlet extends HttpServlet {
    private static final long serialVersionUID = 1L;

    public MyTeachCourse_Servlet() {
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String id = request.getParameter("id");
        String cNo;
        List list;
        if (id.equals("seekmine")) {
            cNo = (String)request.getSession().getAttribute("UNAME");
            new ArrayList();
            list = (new TC_Service()).getTeachC(cNo);
            request.setAttribute("list", list);
            if (list.size() > 0) {
                request.getRequestDispatcher("/jsp/teacher/t/MyTeachCourse.jsp").forward(request, response);
            } else {
                request.getSession().setAttribute("message", "没有你的课程！");
                request.getSession().setAttribute("url", "");
                response.sendRedirect("Message.jsp");
            }
        } else if (id.equals("student")) {
            cNo = request.getParameter("No");
            new ArrayList();
            list = (new TC_Service()).seekElectS(cNo);
            request.setAttribute("courseNo", cNo);
            request.setAttribute("list", list);
            request.getRequestDispatcher("/jsp/teacher/t/MyStudents.jsp").forward(request, response);
        }

    }
}
